package com.wejoy.video.middle.station.data.enums.dict;

/**
 * @Author miracle_j
 * Create by 2024/12/11 12:07
 */
public enum EnumCameraType {
    // 0视频监控 1无人机 2执法仪
    VIDEO_MONITOR(0,"视频监控"),
    DRONE(1,"无人机"),
    LAW_MONITOR(2,"执法仪")
            ;

    private Integer code;
    private String text;

    EnumCameraType(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    /**
     * 通过code获得该枚举类型
     * @param code
     * @return
     */
    public static EnumCameraType getByCode(Integer code) {
        EnumCameraType[] values = EnumCameraType.values();
        for(EnumCameraType type : values) {
            if(type.code == code) {
                return type;
            }
        }
        return null;
    }

    /**
     * 通过code获得该枚举类型
     * @param text
     * @return
     */
    public static EnumCameraType getByTxt(String text) {
        EnumCameraType[] values = EnumCameraType.values();
        for(EnumCameraType type : values) {
            if(type.text.equals(text)) {
                return type;
            }
        }
        return null;
    }
}
